﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Exam.BLL;
using Exam.Model;
namespace ExaminationWeb.Controllers
{
    public class ProductController : Controller
    {
        //
        // GET: /Product/
        ProductService productService = new ProductService();
        public ActionResult ProductList()
        {
            return View();
        }
        public ActionResult ProductAdd()
        {
            return View();
        }
        public ActionResult ProductUpdate()
        {
            return View();
        }
        /// <summary>
        /// 根据ModalityID 获取Product
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        [AllowAnonymous]
        public JsonResult GetProductByMID(string id)
        {
            Guid guid;
            if (Guid.TryParse(id, out guid))
            {
                IQueryable<Product> listcity = productService.LoadEntites(e => e.ModalityID == guid);
                return Json(listcity, JsonRequestBehavior.AllowGet);
            }

            return Json("", JsonRequestBehavior.AllowGet);
        }
    }
}
